﻿@model CNRegex.Web.Models.ModelBlogDetail

@{
    ViewBag.Title = "Detail";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/css/BlogDetail.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/syntaxhighlighter/shCore.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/syntaxhighlighter/shThemeDefault.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/syntaxhighlighter/shCore.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/syntaxhighlighter/shBrushCSharp.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kindeditor/kindeditor-min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.cookie.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/common.js")" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function () {
		if(document.getElementById("Comment")!=null)
			registerKindeditor("Comment");
		SyntaxHighlighter.all()
	}
	);
</script>
<h2 class="t_h2">@Model.Blog.Title</h2>
<div class="bd_right_content">
	
	<div class="bd_author">
		<img src="/images/author.png" alt="author" />
		<div class="bd_img_top">作者 - <a href="/@Model.BlogAuthor.Name">@Model.BlogAuthor.Name</a></div>
		<div>写于 - @Model.Blog.CreateDate.ToString("yyyy/MM/dd")</div>
	</div>
	<div class="bd_blog_info">
		<div class="bd_upup"onclick="recommend('/blog/recommend/','@Model.Blog.ID','spanRecommendTimes','','recommendBlogCookie','您已经推荐过此文章,谢谢.')">
			<span id="spanRecommendTimes">@Model.Blog.Recommend</span>
		</div>
		<div class="bd_img_top">浏览 / @Model.Blog.ClickCount</div>
		<div>推荐 / @Model.Blog.Recommend</div>
	</div>
	<div class="clear bd_line"></div>
	<div>
		<div class="bd_list_blog_title">(他/她) 最新的文章</div>
		<ul class="bd_list_blog">
			@for (int i = 0; i < Model.LatestBlogs.Count; i++)
   {
		<li>
			<a href="/blog/detail/@Model.LatestBlogs[i].ID">@Model.LatestBlogs[i].Title</a>
		</li>
   }
		<li><a href="/">...</a></li>
		</ul>
	</div>

	<div>
		<div class="bd_list_blog_title">(他/她) 最被看好的文章</div>
		<ul class="bd_list_blog">
			@for (int i = 0; i < Model.RecommendBlogs.Count; i++)
   {
		<li>
			<a href="/blog/detail/@Model.RecommendBlogs[i].ID">@Model.RecommendBlogs[i].Title</a>
		</li>
   }
		<li><a href="/">...</a></li>
		</ul>
	</div>

</div>
<div class="bd_left_content">
	<div class="bd_blog_conent">
		@Html.Raw(Model.BlogContent.Content)
	</div>

	<div class="site_comments">
		<div>
			<h2 class="t_h2">评论:</h2>
			@using (Html.BeginForm("Comment", "Blog"))
   {
	   if (CNRegex.Web.Base.FrontContext.CurrentRegexUser == null)
	   {
					<div class="site_comment_account">请您先 <a href="/account/login">登录</a> ,如果您没有帐号,请先 <a href="/account/register">注册</a></div>
	   }
	   else
	   {
					<div class="">
						@Html.TextArea("Comment", new { style = "height:150px;" })
					</div>
					@Html.Hidden("UserBlogID", Model.BlogID)
					<input type="submit" value="发表评论" class="site_submit" />
	   }
   }
		</div>

		<ul>
			@for (int i = 0; i < Model.BlogComments.Count(); i++)
   {
				<li>
					<span class="site_comment_serial">@(i + 1)</span>
					<a href="/@Model.BlogComments[i].RegexUserName">@Model.BlogComments[i].RegexUserName</a>
					<span class="site_comment_date">发表于 : @Model.BlogComments[i].CommentDate.ToString("yyyy-MM-dd hh:mm:ss")</span>
					<div class="site_comment_content">
						@(new HtmlString(Model.BlogComments[i].Comment))
					</div>
				</li>
   }
		</ul>
		@{
			Html.RenderPartial("/Views/Controls/Paginate.cshtml",Model.Paginate);
		}
	</div>
</div>
<div class="clear"></div>
